home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
snpd9611.zip
/
EXT_KEYS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1996-11-24
|
2KB
|
68 lines
.I 0 2
/* +++Date last modified: 23-Nov-1996 */
.I 16 6
** The user is granted a free limited license to use this source file
** to create royalty-free programs, subject to the terms of the
** license restrictions specified in the LICENSE.MFL file.
**
** Revisions:
** 30-Mar-96 Ed Blackman OS/2 mods
.D 17 1
.I 25 2
#define USING_DOS 0 /* Set to 1 to call DOS instead of the BIOS */
.I 28 10
#ifdef __OS2__
extern KBDKEYINFO ki; /* defined in ISSHIFT.C */
KBDINFO kb_state;
kb_state = setkbmode(); /* Change keyboard to binary mode */
KbdCharIn(&ki, IO_WAIT, 0); /* Get the key */
restkbmode(kb_state); /* restore previous keyboard mode */
key = (ki.chScan << 8) + ki.chChar; /* format it into an int */
#else /* assume DOS */
.I 30 11
#if USING_DOS
regs.h.ah = 7;
intdos(®s, ®s);
key = regs.h.al;
if (0 == key)
{
regs.h.ah = 7;
intdos(®s, ®s);
key = (regs.h.al << 8);
}
#else
.I 33 1
#endif
.I 54 1
#endif
.I 65 25
#ifdef __OS2__
KBDINFO setkbmode(void)
{
USHORT rc;
KBDINFO kb_state;
kb_state.cb = sizeof(kb_state);
KbdGetStatus(&kb_state, 0);
kb_state.fsMask &= ~KEYBOARD_ASCII_MODE;
kb_state.fsMask |= KEYBOARD_BINARY_MODE;
rc = KbdSetStatus(&kb_state, 0);
/* if(rc) printf("KbdSetStatus rc = %04x\n", rc); */
return kb_state;
}
void restkbmode(KBDINFO kb_state) /* restore keyboard mode */
{
USHORT rc;
rc = KbdSetStatus(&kb_state, 0);
}
#endif /* !__OS2__ */